package com.cn.txx.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;


@Controller
@RequestMapping("/jump")
public class JumpController {

	@RequestMapping("/auth.do")
	public String jumpAuth(){
		
		return "auth/auth";
	}
	
	@RequestMapping("/set.do")
	public void setSession(HttpSession session){
		session.setAttribute("SESSION", Math.round(Math.random()*10000+1));
	}
	
	@ResponseBody
	@RequestMapping(value="/get.do",produces = "application/json; charset=utf-8")
	public String getSession(HttpSession session){
		
		if(!StringUtils.isEmpty(session.getAttribute("SESSION"))){
			return "<h1>【"+System.getProperty("user.dir")+"】:"+session.getAttribute("SESSION").toString()+"</h1>";
		}
		return "【"+System.getProperty("user.dir")+"】:-99";
	}
}
